//
//  AIChageLangV.m
//  HNBaseProject
//
//  Created by xujie on 2024/8/27.
//

#import "AIChageLangV.h"

@implementation AIChageLangV

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self createUI];
    }
    return self;
}

- (void)createUI {
    self.width = kScreenW - 60;
    self.height = 241;
    self.layer.cornerRadius = 15;
    self.layer.masksToBounds = YES;
    self.backgroundColor = [UIColor colorWithHexString:@"#DBEDFF"];
    
    UILabel *topLab = [[UILabel alloc] init];
    [self addSubview:topLab];
    topLab.text = @"切换语言";
    topLab.font = PFRFontMedium(15);
    topLab.textColor = [UIColor colorWithHexString:@"#333333"];
    [topLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self);
        make.top.offset(24);
        make.height.mas_equalTo(21);
    }];
    
    UIImageView *leftV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"kefu_left"]];
    [self addSubview:leftV];
    [leftV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(topLab);
        make.right.mas_equalTo(topLab.mas_left).offset(-9);
    }];
    
    UIImageView *rightV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"kefu_right"]];
    [self addSubview:rightV];
    [rightV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(topLab);
        make.left.mas_equalTo(topLab.mas_right).offset(9);
    }];
    
    UILabel *tipLab = [[UILabel alloc] init];
    [self addSubview:tipLab];
    tipLab.text = @"是否确认切换语言？";
    tipLab.font = PFRFontSemibold(18);
    tipLab.textColor = [UIColor colorWithHexString:@"#000000"];
    [tipLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self);
        make.top.offset(81);
    }];
    
    UILabel *tipLabBottom = [[UILabel alloc] init];
    [self addSubview:tipLabBottom];
    tipLabBottom.text = @"切换后将作用于本应用所有字体";
    tipLabBottom.font = PFRFont(14);
    tipLabBottom.textColor = [UIColor colorWithHexString:@"#666666"];
    [tipLabBottom mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self);
        make.top.offset(118);
    }];
    
    MJWeakSelf
    UILabel *cancleLab = [[UILabel alloc] init];
    cancleLab.textAlignment = NSTextAlignmentCenter;
    cancleLab.text = @"取消";
    cancleLab.textColor = [UIColor colorWithHexString:@"#7D7C81"];
    cancleLab.font = PFRFont(14);
    cancleLab.layer.borderWidth = 1;
    cancleLab.layer.borderColor = [UIColor colorWithHexString:@"#CCCCCC"].CGColor;
    cancleLab.userInteractionEnabled = YES;
    cancleLab.layer.cornerRadius = 21;
    cancleLab.layer.masksToBounds = YES;
    [cancleLab addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithActionBlock:^(id  _Nonnull sender) {
        if (weakSelf.cancleClick) {
            weakSelf.cancleClick();
        }
    }]];
    [self addSubview:cancleLab];
    [cancleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(42);
        make.width.mas_equalTo(128);
        make.bottom.offset(-25);
        make.left.offset(24);
    }];
    
    UILabel *sureLab = [[UILabel alloc] init];
    sureLab.textAlignment = NSTextAlignmentCenter;
    sureLab.text = @"确认切换";
    sureLab.textColor = [UIColor whiteColor];
    sureLab.font = PFRFont(14);
    sureLab.userInteractionEnabled = YES;
    sureLab.layer.cornerRadius = 21;
    sureLab.layer.masksToBounds = YES;
    sureLab.backgroundColor = [UIColor colorWithHexString:@"#1D8EFF"];
    [sureLab addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithActionBlock:^(id  _Nonnull sender) {
        if (weakSelf.sureClick) {
            weakSelf.sureClick();
        }
    }]];
    [self addSubview:sureLab];
    [sureLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(42);
        make.width.mas_equalTo(128);
        make.bottom.offset(-25);
        make.right.offset(-24);
    }];
}


@end
